/**
 * build_project
 * <p>
 * Copyright 2014 cayden.cn, Inc. All rights reserved.
 *
 * @author Administrator
 * @date 2021-06-23 12:38
 */
package com.cayden.config.boot.listener;

import com.cayden.config.boot.ApplicationContextHolder;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.PriorityOrdered;

/**
 *
 * @author cayden
 * @date 2021-06-24 12:38
 */
public class CaydenHolderInitApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext>, PriorityOrdered {

    @Override
    public void initialize(ConfigurableApplicationContext applicationContext) {
        if (applicationContext.getEnvironment().getPropertySources().get("bootstrap") == null) {
            (new ApplicationContextHolder()).setApplicationContext(applicationContext);
        }
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
